<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
	

	<div class="bjui-pageHeader" style="background-color:#fefefe; border-bottom:none;">
		<form>
		 	    <fieldset>
		        <div style="margin:0; padding:1px 5px 5px;">
		    <!--    <span style="font-size:15px;font-weight: 500;">锁编号：</span> &nbsp
		            <input type="text"  name="message_nickname" class="form-control" size="10" style="height:20px;width:120px ">        
		            &nbsp;  -->
		       <span style="font-size:15px;font-weight: 500;">入库员：</span> &nbsp;
		            <input type="text"  name="message_username" class="form-control" size="10" style="height:20px;width:120px ">  
		       &nbsp; <span style="font-size:15px;font-weight: 500;">分配单位：</span> &nbsp;
		            <input type="text"  name="message_name" class="form-control" size="10" style="height:20px;width:120px ">   &nbsp;
		          <span style="font-size:15px;font-weight: 500;">时间查询：</span> &nbsp;		
				 <select id="message_sto_select_day"  style="height:20px; font-size: 12px; width: 70px">
					         <option value="3" style="height:20px; font-size:12px">三天内</option>
					         <option value="7" style="height:20px; font-size:12px">一周内</option>
					         <option value="15" style="height:20px; font-size:12px">半月内</option>
					         <option value="30" style="height:20px; font-size:12px">一月内</option>
					         <option value="0" selected=""  style="height:20px; font-size:12px">全部</option>
					      </select>
		            <div class="btn-group">
		                <button type="button" onClick='message_searchdata()' class="btn-green" data-icon="search" style="height:20px; font-size:12px">开始搜索！<tton>
		                <button type="reset" class="btn-orange" data-icon="times" style="height:20px; font-size:12px">重置<tton>
		            </div>
		        </div>
		    </fieldset>
		</form>
	</div>
	
      <div class="bjui-pageContent">
		<table id="sto_message_id" class="table table-bordered"></table>
	</div>
	</div>
	
	<script type="text/javascript">
	$(function(){
		$('#sto_message_id').datagrid({
			height: '100%',
			showToolbar: true,//显示工具栏
			//  toolbarCustom:'<button type="button" class="btn-green" data-toggle="dialog" data-icon="edit" data-options="{id:\'sto_lock\',url:\'ialog/sto_lock\',fresh:true,width:800,height:500}">新增</button>',
			toolbarItem: 'edit,del,|,save,cancel,|,import,export',//定义工具内容
			gridTitle : '入库信息',//表格名称
			filterThead: false,
			dataUrl: 'searchAllLockInfo',//表格数据源
		    dataType: 'json',//数据类型
	        local:'remote',//分页显示
	        paging:{pageSize:30,selectPageSize:'30,45,60',pageCurrent:1},
	      //  editMode: {dialog:{width:400,height:400,title:'编辑用户信息',mask:true ,url:'dialog/sto_lock'}},//修改数据对话框的信息
	        editUrl: 'updateByPrimaryKey',//修改对话框的地址
	        delUrl:'deleteTLockInfo',//删除请求地址
	        editCallback:sto_messageCallback,
	        delCallback:sto_messagedelCallback,
	        delPK:'tid',
	        showCheckboxcol: true,//显示多选框
	        linenumberAll: true,//显示编号值
	        columns:[
	        	 { name: 'lockNo',label: '锁具编号', align: 'center',width: 100},
	        	 { name: 'hInfo',label: '硬件信息', align: 'center',width: 100},
	        	 { name: 'locType',label: '型号', align: 'center',width: 100},
	        	 { name: 'name',label: '分配单位', align: 'center',width: 100},
	        	 { name: 'username',label: '入库人员', align: 'center',width: 100},
	        	 { name: 'eDate',label: '入库时间', align: 'center',width: 150,render:'get_date'},
	        ],
	      //  toolbarCustom:'<button type="button"  data-toggle="dialog" data-options="{id:"/sto_lock"/,url:\'dialog/sto_lock \'}">添加</button>'
	        toolbarCustom:'<button type="button" class="btn-green" data-toggle="dialog" data-icon="plus" data-options="{id:\'sto_lock\',url:\'dialog/sto_lock\',fresh:true,width:450,height:400}">入库</button><button type="button" class="btn-green" data-toggle="dialog" data-icon="plus" data-options="{id:\'sto_lock\',url:\'dialog/sto_lock_lotype\',fresh:true,width:450,height:400}">型号新增</button>'	
	        
	})
});
	
	function sto_messageCallback(json){
		
		if(json.check == '00')
			{
				BJUI.alertmsg('info','修改成功');
				$('#sto_message_id').datagrid('refresh',true);
			}
		else
			BJUI.alertmsg('info','修改失败');
	}
	
	function sto_messagedelCallback(json){
		if(json.check == '00')
		{
			BJUI.alertmsg('info','删除成功');
			$('#sto_message_id').datagrid('refresh',true);
		}
	else
		BJUI.alertmsg('info','删除失败');
}
	
	//表单搜索，
	function message_searchdata(){
		var a  = $('#message_sto_select_day').val();
		var username = $("[name='message_username']").val();
		var name = $("[name='message_name']").val();
		if(a!=0)
			{
			 start = get_newdate(-1);
			 end = get_newdate(a);
			 $('#sto_message_id').datagrid('reload',{
				 columns: [ 
					 { name: 'lockNo',label: '锁具编号', align: 'center',width: 100},
		        	 { name: 'hInfo',label: '硬件信息', align: 'center',width: 100},
		        	 { name: 'locType',label: '型号', align: 'center',width: 100},
		        	 { name: 'name',label: '分配单位', align: 'center',width: 100},
		        	 { name: 'username',label: '入库人员', align: 'center',width: 100},
		        	 { name: 'eDate',label: '入库时间', align: 'center',width: 150,render:'get_date'},
				        ],
				postData:{
					info:"{"+
						"\"username\":\""+username+"\","+
						"\"name\":\""+name+"\","+
						"\"endDate\":\""+end+"\","+
						"\"startDate\":\""+start+	"\""+
						"}"
				}
			});
			}
		else{
			$('#sto_message_id').datagrid('reload',{
				 columns: [ 
					 { name: 'lockNo',label: '锁具编号', align: 'center',width: 100},
		        	 { name: 'hInfo',label: '硬件信息', align: 'center',width: 100},
		        	 { name: 'locType',label: '型号', align: 'center',width: 100},
		        	 { name: 'name',label: '分配单位', align: 'center',width: 100},
		        	 { name: 'username',label: '入库人员', align: 'center',width: 100},
		        	 { name: 'eDate',label: '入库时间', align: 'center',width: 150,render:'get_date'},
				        ],
				postData:{
					info:"{"+
							"\"username\":\""+username+"\","+
							"\"name\":\""+name+"\""+
						"}"
				}
			});
		
		}
		
	}
	
	
	
	</script>